package day20171116;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;

/**
 * Created by Administrator on 2017-11-16.
 */
public class FileWriteTest {


    public static void main(String[] args) {


        // 1. 写文件
        // 1.1 字符流: BufferedWriter, FileWriter
        String path = "E:\\hello.txt";

        BufferedWriter writer = null;
        try {
            writer = new BufferedWriter(new FileWriter(path));

//            writer.write(65);

            writer.write("hello,world!");
            writer.newLine();
            writer.write("101100101101001101010");
            writer.newLine();
            writer.write("bye!!!!!!!!!!!!!!");

        } catch (IOException e) {
            e.printStackTrace();
        } finally {

            try {
                writer.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }


        // 1.2 字节流


    }


}
